package com.fengxing.ams.web.facade.mouble.word;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

public interface IWordDAO extends PagingAndSortingRepository<ProfessionalWordVO, Integer>, JpaSpecificationExecutor<ProfessionalWordVO>  {

	@Query(value="SELECT * FROM zyt_professional_word where enable = 1 ORDER BY weight DESC LIMIT 0, 10", nativeQuery=true)
	List<ProfessionalWordVO> findhotWords();
	
	@Query(value="SELECT * FROM zyt_professional_word where enable = 1", nativeQuery=true)
	List<ProfessionalWordVO> findAllWords();

	@Modifying
	@Query(value="update zyt_professional_word  set weight=weight + 1 where id=:id", nativeQuery=true)
	void updateWeight(@Param("id")Integer id);

}
